package de.revdev.streckenliste.entities;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author f.lindermaier
 */
@Entity
@Table(name = "tbl_Wildart")
public class Wildart implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "idWildart")
    private Long id;
    @Size(min = 1, max = 40)
    private String nameWA;
    @ManyToOne
    @JoinColumn(name = "idWildTyp")
    private Wildtyp wildtyp;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNameWA() {
        return nameWA;
    }

    public void setNameWA(String nameWA) {
        this.nameWA = nameWA;
    }

    public Wildtyp getWildtyp() {
        return wildtyp;
    }

    public void setWildtyp(Wildtyp wildtyp) {
        this.wildtyp = wildtyp;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Wildart)) {
            return false;
        }
        Wildart other = (Wildart) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "de.revdev.streckenliste.entities.Wildart[ id=" + id + " ]";
    }
}
